// 基础配置
export const commonConfiguration = {
  //只能查看
  "isOnlyView": true,
  //组合方式限制
  "limit": 10,
  //组合方式
  "options": [
    {
      value: '1',
      label: '人脸',
    },
    {
      value: '2',
      label: '掌静脉',
    },
    {
      value: '3',
      label: '通行卡',
    },
    {
      value: '4',
      label: '密码',
    },
  ],
  //门锁状态
  'options2': [
    {
      value: 1,
      label: '开门',
    },
    {
      value: 2,
      label: '开锁',
    },
  ],
}

//拆解通行方式
export const depart = (arr) => {
  if (arr.length > 1) {
    return arr.split("")
  } else {
    return [arr]
  }
}

// 删除单条定时计划
export const handleDelSingleIntervalPlan = (row, index, type, array, proxy) => {
  return proxy.$confirm(`确定要删除${type}的第${index + 1}条定时计划吗?`).then(res => {
    array.splice(index, 1)
  }).catch(e => {
    console.log(e);
  })
}

// 增加单条定时计划
export const addTimeCommon = (list, trafficRuleType) => {
  const date = new Date()
  return list.push({
    "timeArray": [new Date(date.getFullYear(), date.getMonth(), date.getDate(), 0, 0, 0), new Date(date.getFullYear(), date.getMonth(), date.getDate(), 0, 0, 0)],
    "trafficRuleType": trafficRuleType,
    "doorLock": "",
    "trafficTypeArray": [],
  })
}

// 增加单条组合方式
export const addTrafficTypeCommon = (row, limit, proxy) => {
  // 通行方式row.length -1
  if (row.length > limit - 1) {
    proxy.$message.warning(`最多只能添加${limit}种通行方式 !`)
    return false
  } else {
    return row.push([])
  }
}
export const resetFunDetails = (proxy) => {
  proxy.funDetails.list = []

}




